<template>
  <div id="app">
    <mt-header title="我的音乐 , 我的世界">
      <router-link to="/" slot="left">
        <mt-button icon="back"></mt-button>
      </router-link>
    </mt-header>
    <router-view @sinds="getId"></router-view>

    <!--播放条-->
    <!--将src中的值设为变量  使用方式：“‘固定值 ‘+id+’固定值’” -->
    <audio ref="audio" id="btnaudio" v-bind:src="'http://ws.stream.qqmusic.qq.com/'+id+'.m4a?fromtag=46'" controls loop autoplay="autoplay">
    </audio>
    <nav class="mui-bar mui-bar-tab">
      <router-link class="mui-tab-item" to="/home">
        <span class="mui-icon mui-icon-home"></span>
        <span class="mui-tab-label">首页</span>
      </router-link>
      <router-link class="mui-tab-item" to="/hello">
        <span class="mui-icon mui-icon-email"></span>
        <span class="mui-tab-label">排行榜</span>
      </router-link>
      <router-link class="mui-tab-item" to="/search">
        <span class="mui-icon mui-icon-contact"></span>
        <span class="mui-tab-label">搜索</span>
      </router-link>
    </nav>
  </div>
</template>

<script>
  export default {
    name: 'app',
    data(){
      return {
        id: 20234510300000
      }
    },
    created: {
//      this.$refs.audio
    },
    methods: {
//      将Hellow组件传过来的值赋给id
      getId(input){
        this.id = input;
      }
    }
  }
</script>
<style scoped>
  body {
    margin: 0;
  }

  #app {
    height: 100%;
    overflow: hidden;
  }

  #btnaudio {
    width: 100%;
    position: absolute;
    bottom: 50px;
  }

  audio {
    position: absolute;
    left: 0;
  }

  .mui-bar {
  }
</style>
